/**
 * 
 */
package com.easidea.tim.entity.purchase;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;
import org.springside.core.dao.extend.Undeletable;

import com.easidea.tim.entity.BaseEntity;
import com.easidea.tim.entity.supply.Sup;

/**
 * @author Harrison
 *
 */

@Entity(name="tim_purchase_return")
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Cache(region="tim_purchase_return", usage=CacheConcurrencyStrategy.READ_WRITE)
@Undeletable(status="deleted")
public class PurchaseReturn extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7436551697293592190L;

	private String purchaseReturnNum;//采购退单编号
	
	private Sup supplyer; //供应商
	
	private String responer;//责任人
	
	private String reTel;//收货电话
	
	private String reAddress;//收获地址
	
	private String rePerson;//收货人
	
	private Double piNum;//总匹数
	
	private Double meterNum;//总米数
	
	private Double moneyNum;//总价
	
	private String scheduleMeter;//预计米数
	
	private String memo;//备注
	
	private Short status;//状态
	
	private boolean starFlag;//是否星标
	
	private String flowNo;
	
	private List<PurchaseReturnItem> items; //明细

	/**
	 * @return the purchaseReturnNum
	 */
	@Column(name="purchase_return_num")
	public String getPurchaseReturnNum() {
		return purchaseReturnNum;
	}

	/**
	 * @param purchaseReturnNum the purchaseReturnNum to set
	 */
	public void setPurchaseReturnNum(String purchaseReturnNum) {
		this.purchaseReturnNum = purchaseReturnNum;
	}

	/**
	 * @return the supplyer
	 */
	@ManyToOne(cascade=CascadeType.MERGE)
	@JoinColumn(name="supplyer_id",nullable=false)
	public Sup getSupplyer() {
		return supplyer;
	}

	/**
	 * @param supplyer the supplyer to set
	 */
	public void setSupplyer(Sup supplyer) {
		this.supplyer = supplyer;
	}

	/**
	 * @return the responer
	 */
	@Column(name="responser")
	public String getResponer() {
		return responer;
	}

	/**
	 * @param responer the responer to set
	 */
	public void setResponer(String responer) {
		this.responer = responer;
	}

	/**
	 * @return the reTel
	 */
	@Column(name="relate_tel")
	public String getReTel() {
		return reTel;
	}

	/**
	 * @param reTel the reTel to set
	 */
	public void setReTel(String reTel) {
		this.reTel = reTel;
	}

	/**
	 * @return the reAddress
	 */
	@Column(name="relate_address")
	public String getReAddress() {
		return reAddress;
	}

	/**
	 * @param reAddress the reAddress to set
	 */
	public void setReAddress(String reAddress) {
		this.reAddress = reAddress;
	}

	/**
	 * @return the rePerson
	 */
	@Column(name="relate_person")
	public String getRePerson() {
		return rePerson;
	}

	/**
	 * @param rePerson the rePerson to set
	 */
	public void setRePerson(String rePerson) {
		this.rePerson = rePerson;
	}

	/**
	 * @return the piNum
	 */
	@Column(name="pi_num", columnDefinition="decimal(8,0) not null", nullable=false)
	public Double getPiNum() {
		return piNum;
	}

	/**
	 * @param piNum the piNum to set
	 */
	public void setPiNum(Double piNum) {
		this.piNum = piNum;
	}

	/**
	 * @return the meterNum
	 */
	@Column(name="meter_num", columnDefinition="decimal(15,2) not null", nullable=false)
	public Double getMeterNum() {
		return meterNum;
	}

	/**
	 * @param meterNum the meterNum to set
	 */
	public void setMeterNum(Double meterNum) {
		this.meterNum = meterNum;
	}

	/**
	 * @return the moneyNum
	 */
	@Column(name="money_num", columnDefinition="decimal(18,3) not null", nullable=false)
	public Double getMoneyNum() {
		return moneyNum;
	}

	/**
	 * @param moneyNum the moneyNum to set
	 */
	public void setMoneyNum(Double moneyNum) {
		this.moneyNum = moneyNum;
	}

	/**
	 * @return the scheduleMeter
	 */
	@Column(name="schedule_meter")
	public String getScheduleMeter() {
		return scheduleMeter;
	}

	/**
	 * @param scheduleMeter the scheduleMeter to set
	 */
	public void setScheduleMeter(String scheduleMeter) {
		this.scheduleMeter = scheduleMeter;
	}

	/**
	 * @return the memo
	 */
	@Column(name="memo")
	public String getMemo() {
		return memo;
	}

	/**
	 * @param memo the memo to set
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}

	/**
	 * @return the status
	 */
	@Column(name="status")
	public Short getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(Short status) {
		this.status = status;
	}

	/**
	 * @return the starFlag
	 */
	@Column(name="star_flag")
	public boolean isStarFlag() {
		return starFlag;
	}

	/**
	 * @param starFlag the starFlag to set
	 */
	public void setStarFlag(boolean starFlag) {
		this.starFlag = starFlag;
	}

	/**
	 * @return the flowNo
	 */
	@Column(name="flow_no")
	public String getFlowNo() {
		return flowNo;
	}

	/**
	 * @param flowNo the flowNo to set
	 */
	public void setFlowNo(String flowNo) {
		this.flowNo = flowNo;
	}

	/**
	 * @return the items
	 */
	@OneToMany(mappedBy="purchaseReturn")
	@Where(clause="deleted <> 1")
	public List<PurchaseReturnItem> getItems() {
		return items;
	}

	/**
	 * @param items the items to set
	 */
	public void setItems(List<PurchaseReturnItem> items) {
		this.items = items;
	}
}
